package com.xu.modules.controller;

import cn.hutool.extra.servlet.ServletUtil;
import cn.hutool.http.useragent.UserAgentUtil;
import com.xu.common.domain.MyResult;
import com.xu.common.utils.ServletUtils;
import com.xu.modules.service.FriendService;
import com.xu.modules.service.bo.CommentBo;
import com.xu.modules.service.bo.FriendBo;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 友链 前端控制器
 * </p>
 *
 * @author xu
 * @since 2022-07-27
 */
@RestController
@RequestMapping("/friend")
@RequiredArgsConstructor
public class FriendController {
    private final FriendService friendService;

    @PostMapping("/add")
    public MyResult add(@RequestBody @Valid FriendBo friendBo){
        friendService.add(friendBo);
        return MyResult.ok();
    }

    @GetMapping("/listAll")
    public MyResult listAll(){
        return MyResult.ok(friendService.listAll());
    }
}
